import { t } from '@src/locales';
import formatColumn from 'packages/BaseTableCell/formatColumn';

// 列表 && 选择列
export const getColumnFields = () => {
  return [
    {
      fieldName: 'serialnumber',
      displayName: t('im.imChat.components.mailChat.text1'),
      formType: 'text',
    },
    {
      fieldName: 'emailSubject',
      displayName: t('common.bizComponents.bizSendEmail.label.subject'),
      formType: 'text',
    },
    {
      fieldName: 'customerName',
      displayName: t('common.label.customerName'),
      formType: 'text',
    },
    {
      fieldName: 'linkmanName',
      displayName: t('common.label.contact'),
      formType: 'text',
    },
    {
      fieldName: 'phone',
      displayName: t('common.label.phone'),
      formType: 'text',
    },
    {
      fieldName: 'address',
      displayName: t('common.label.address'),
      formType: 'text',
    },
    {
      fieldName: 'email',
      displayName: t('common.label.email'),
      formType: 'text',
    },
    {
      fieldName: 'sentDate',
      displayName: t('im.imChat.components.mailChat.text2'),
      formType: 'date',
    },
  ].map(item => {
    let field = {
      ...item,
      setting: item.setting || {},
      isSystem: 1,
      isNull: 1,
      orderId: 1,
      show: true,
      tableName: 'mailManagementList',
      minWidth: 150,
      visable: typeof item.visable == 'undefined' ? true : item.visable,
    };
    return formatColumn(field);
  });
};

// 高级搜索
export const getAdvancedFields = (vm, options) => {
  return [
    {
      fieldName: 'serialnumber',
      displayName: t('im.imChat.components.mailChat.text1'),
      formType: 'text',
    },
    {
      fieldName: 'subject',
      displayName: t('common.bizComponents.bizSendEmail.label.subject'),
      formType: 'text',
    },
    {
      fieldName: 'customer',
      displayName: t('common.label.customerName'),
      formType: 'text',
    },
    {
      fieldName: 'linkmanId',
      displayName: t('common.label.contact'),
      formType: 'select',
    },
    {
      fieldName: 'email',
      displayName: t('common.label.email'),
      formType: 'text',
    },
    {
      fieldName: 'sentDate',
      displayName: t('im.imChat.components.mailChat.text2'),
      formType: 'datetime',
    },
  ].map(item => {
    return {
      ...item,
      setting: item.setting || {},
      defaultValue: null,
      show: true,
      isNull: 1,
      isSystem: 1,
      orderId: 1,
    };
  });
};